package com.hdsx.restful.hyzt.gk.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.hdsx.ao.base.BaseOpearte;
import com.hdsx.restful.hyzt.gk.bean.Gk;
import com.hdsx.restful.hyzt.gk.mapper.GkMapper;
import com.hdsx.restful.hyzt.gk.service.GkService;

@Service
public class GkServiceImpl extends BaseOpearte<Gk> implements GkService {
	public GkServiceImpl() {
		super("GIS_GK");
	}

	@Resource(name = "gkMapper")
	private GkMapper mapper;

	@Override
	public int queryCount(String xzqhbm, String name, String sznhhd) {
		Map<String, Object> parameter = new HashMap<String, Object>();
		parameter.put("xzqhbm", xzqhbm);
		parameter.put("name", name);
		parameter.put("sznhhd", sznhhd);
		return mapper.queryCount(parameter);
	}

	@Override
	public List<Gk> queryList(String xzqhbm, String name, String sznhhd,
			int begin, int end) {
		Map<String, Object> parameter = new HashMap<String, Object>();
		parameter.put("xzqhbm", xzqhbm);
		parameter.put("name", name);
		parameter.put("sznhhd", sznhhd);
		parameter.put("begin", begin);
		parameter.put("end", end);
		List<Gk> lists = mapper.queryList(parameter);
		for (Gk gk : lists) {
			gk.setShape(selectShape("ID='" + gk.getId() + "'"));
		}
		return lists;
	}
	
	@Override
	public Gk queryById(String id) {
		return mapper.selectById(id);
	}
	@Override
	public List<String> selectName(String name){
		return mapper.selectName(name);
	}
}
